package com.corhyfar.dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.corhyfar.beans.TipoPADTO;
import com.corhyfar.dao.TipoPADAO;
import com.corhyfar.util.SQLConnection;

public class TipoPADaoImpl implements TipoPADAO {

	Connection cn = null;
	PreparedStatement ps = null;
	ResultSet rs = null;

	@Override
	public List<TipoPADTO> listarTipoPA() throws SQLException {
		cn = new SQLConnection().GetConnection();
		String sql = "select * from Actividad";
		ps = cn.prepareStatement(sql);
		rs = ps.executeQuery();
		List<TipoPADTO> lista = new ArrayList<TipoPADTO>();
		while (rs.next()) {

			lista.add(new TipoPADTO(rs.getInt(0), rs.getString(1), rs.getInt(2)));

		}
		ps.close();
		cn.close();
		return lista;

	}

}
